package exmpcase;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;

public class Test4 {
    public static void main(String[] args) throws ParseException {
        String birthday = "1998年9月13日";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        Date date = sdf.parse(birthday);
        long birTime = date.getTime();
        long now = System.currentTimeMillis();
        long diff = now - birTime;
        System.out.println(diff/1000/60/60/24);

        //JDK8
        LocalDate localDate = LocalDate.of(1998,9,13);
        LocalDate now2 = LocalDate.now();
        long diff2 = now2.toEpochDay() - localDate.toEpochDay();
        System.out.println(diff2);
    }
}
